package freedom.sample;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.orm.hibernate3.HibernateTemplate;

public class Main {
    public static void main(String[] args) throws Exception {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("spring-j2cache.xml");
        HibernateTemplate hibernateTemplate = (HibernateTemplate)ctx.getBean("hibernateTemplate");
        Help help = (Help)hibernateTemplate.get(Help.class, "code");
        System.out.println(help.getHelpCode() + ":" + help.getContent());
        help.setContent("测试1");
        hibernateTemplate.saveOrUpdate(help);
        help = (Help)hibernateTemplate.get(Help.class, "code");
        System.out.println(help.getHelpCode() + ":" + help.getContent());

    }
}
